#include "stdafx.h"
#include "MLP.h"
#include "MLP Form.h"

namespace SimpleGUI
{
	// Constructor and Destructor

	template <class T, class U> MLP<T, U>::MLP(nnse::MLP<T, U>^ p)
	: parent(p)
	{
		InitializeComponent();
	};

	template <class T, class U> MLP<T, U>::~MLP()
	{
		if (components)
		{
			delete components;
		}
	};

	// GUI Functions

	template <class T, class U> System::Void MLP<T, U>::view_button_Click(System::Object^  sender, System::EventArgs^  e)
	{
		parent->display_layers();
	};

	template <class T, class U> System::Void MLP<T, U>::form_closed(System::Object^  sender, System::Windows::Forms::FormClosedEventArgs^  e)
	{
		parent->invalidate_form();
	};

	template <class T, class U> System::Void MLP<T, U>::update_form()
	{
		number_textBox->Text=parent->get_number().ToString();
		seed_textBox->Text=parent->get_seed().ToString();
		number_of_iterations_textBox->Text=parent->get_number_of_iterations().ToString();
		learning_rate_textBox->Text=parent->get_learning_rate().ToString();
		momentum_flag_textBox->Text=parent->get_momentum_flag().ToString();
		momentum_value_textBox->Text=parent->get_momentum_value().ToString();
		number_of_hidden_layers_textBox->Text=parent->get_number_of_hidden_layers().ToString();
		this->Refresh();
	};

	// Explicit Instantiation

	template ref class MLP<bool, double>;
	template ref class MLP<unsigned char, double>;
}
